package com.bbdjt.weixin.service.impl;

import java.util.List;


import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.util.StringUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.bbdjt.weixin.model.RoleQueryModel;
import com.bbdjt.weixin.base.service.impl.BaseServiceImpl;
import com.bbdjt.weixin.dao.RoleDao;
import com.bbdjt.weixin.model.Role;
import com.bbdjt.weixin.service.RoleService;

@Service("roleService")
public class RoleServiceImpl extends BaseServiceImpl<Role> implements RoleService {
	
	@Override
    public List<Role> selectByRole(Role role, int page, int rows) {
        Example example = new Example(Role.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(role);
        PageHelper.startPage(page, rows);
        return selectByExample(example);
    }
    
    @Override
    public List<Role> selectByRole(Role role) {
        Example example = new Example(Role.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(role);
        return selectByExample(example);
    }

    @Override
    public PageInfo<RoleQueryModel> selectByRoleQueryModel(RoleQueryModel role) {
    	return ((RoleDao) getMapper()).selectByRoleModel(role);
    }

	@Override
	public List<Role> selectByRole(RoleQueryModel role) {
		  Example example = new Example(Role.class);
	        Example.Criteria criteria = example.createCriteria();
	        criteria.andEqualTo(role);
	        PageHelper.startPage(role.getPageNum(), role.getPageSize(),role.getOrderBy());
	        return selectByExample(example);
	}

	
}